package cn.findviewbydream.evil.bigtoutiao.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.findviewbydream.evil.bigtoutiao.R;
import okhttp3.Call;

/********************************************
 * 工程名：BigTouTiao
 * 包名：cn.findviewbydream.evil.bigtoutiao.activity
 * 时间：17-7-2
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：
 ********************************************/
public class TestActivity extends AppCompatActivity
{
    @BindView(R.id.text)
    TextView text;
    @BindView(R.id.btn)
    Button btn;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        ButterKnife.bind(this);

        btn.setOnClickListener(view ->
        {
            OkGo.get("http://192.168.1.84:3000/json")
                    .execute(new StringCallback()
                    {
                        @Override
                        public void onSuccess(String s, Call call, okhttp3.Response response)
                        {
                            text.setText(s);
                        }
                    });
        });

    }
}
